package com.swdegao.iot.netty.thread;

import com.swdegao.iot.netty.entity.Ports;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.swdegao.iot.netty.udp.server.NettyUDPServer;

/**
 * Netty 线程启动netty服务器监听
 * @Author:AwakeningCode
 * @Date: Created in 18:50 2018\1\30 0030
 */
public class NettyUdpServerThread extends Thread{

	private final static Logger logger = LoggerFactory.getLogger(NettyUdpServerThread.class);
    private Ports port;
    private boolean _run = true;

    public NettyUdpServerThread(Ports port) {
        this.port = port;
    }

    @Override
    public void run() {
    	logger.info("NettyUDPServer run!");
        NettyUDPServer server = new NettyUDPServer();
        server.doStart(port);
    }

    public void stopThread(boolean run){
        this._run = !run;
    }

    public Ports getPort() {
        return port;
    }

    public void setPort(Ports port) {
        this.port = port;
    }

    public boolean is_run() {
        return _run;
    }

    public void set_run(boolean _run) {
        this._run = _run;
    }
}
